package com.zoke.daycarpool.ui;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.zoke.daycarpool.R;
import com.zoke.daycarpool.base.BaseUi;
import com.zoke.daycarpool.config.CarpoolConfig.OpenPlatform;
import com.zoke.daycarpool.thirdapi.QQ;
import com.zoke.support.base.BaseWebActivity;
import com.zoke.support.utils.CommonUtil;

/**
 * 关于我们
 * 
 * @author JackWu
 * @version
 * @date 2015-1-7
 * @_QQ_ 651319154
 */
public class AboutUs extends BaseUi {
	private TextView mWeiboTv;
	private TextView mVersionTv;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_aboutus);
		mEnableSwipeRight = true;
		mTitleManager.setTitle("关于我们");
		mTitleManager.setLeftIcon(R.drawable.title_back);
		mWeiboTv = (TextView) findViewById(R.id.aboutus_weiboTv);
		mVersionTv = (TextView) findViewById(R.id.aboutus_vsioncode);
		//
		mWeiboTv.setText("@天天拼车App");
		try {
			mVersionTv.setText("天天拼车 V"
					+ CommonUtil.getClientVersionName(getApplicationContext()));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/** 加入qq群 **/
	public void onClickQQ(View view) {
		QQ.joinQQGroup(AboutUs.this, OpenPlatform.JOINQQGROUPKEY);
	}

	/** 关注官网微博 **/
	public void onClickWeibo(View view) {
		mIntent = new Intent(AboutUs.this, WeiboWeb.class);
		mIntent.putExtra(BaseWebActivity.WEB_URL, OpenPlatform.ACTIONWEIBOURL);
		startUI(mIntent);
	}

	/** 跳转邮箱 **/
	public void onClickEmail(View view) {

		try {
			Uri uri = Uri.parse("daycarpool@163.com");
			mIntent = new Intent(Intent.ACTION_SENDTO, uri);
			startActivity(mIntent);
		} catch (Exception e) {
			try {
				// 系统邮件系统的动作为android.content.Intent.ACTION_SEND
				Intent email = new Intent(android.content.Intent.ACTION_SEND);
				email.setType("text/plain");
				String[] emailReciver = new String[] { "daycarpool@163.com" };
				// 设置邮件默认地址
				email.putExtra(android.content.Intent.EXTRA_EMAIL, emailReciver);
				// 调用系统的邮件系统
				startActivity(Intent.createChooser(email, "请选择邮件app"));
			} catch (Exception e2) {
			}
		}
	}

}
